﻿// ----------------------------------------------------------------
// Description : 实体类,该文件由MyGeneration生成
// Author      : 
// Create date : 2009-12-06
// ----------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace ITOMMS.Entity
{
	/// <summary>
	///	tbQuestionnaire Entity
	///	tbQuestionnaire Entity调查表
	/// </summary>
	[Serializable]
	public class tbQuestionnaireEntity : BaseEntity<tbQuestionnaireEntity,int>
	{
		
		#region 私有成员			
		
		private int _ID; 
		private string _客户名称; 
		private int? _服务项目; 
		private string _客户电话; 
		private string _反馈人; 
		private bool? _ASK1; 
		private bool? _ASK2; 
		private bool? _ASK3; 
		private bool? _ASK4; 
		private bool? _ASK5; 
		private bool? _ASK6; 
		private bool? _ASK7; 
		private bool? _ASK8; 
		private bool? _ASK9; 
		private bool? _ASK10; 
		private int? _工程师; 
		private int? _专业技术; 
		private int? _服务态度; 
		private int? _总体评价; 
		private DateTime? _CreateDate; 
		private int? _CreateBy; 
		private int _SEQNO;
		#endregion


		
		#region 默认( 空 ) 构造函数
		/// <summary>
		/// 默认构造函数
		/// </summary>
		public tbQuestionnaireEntity()
		{
			_ID = 0; 
			_客户名称 = String.Empty; 
			_服务项目 =  null; 
			_客户电话 = String.Empty; 
			_反馈人 = String.Empty; 
			_ASK1 =  null; 
			_ASK2 =  null; 
			_ASK3 =  null; 
			_ASK4 =  null; 
			_ASK5 =  null; 
			_ASK6 =  null; 
			_ASK7 =  null; 
			_ASK8 =  null; 
			_ASK9 =  null; 
			_ASK10 =  null; 
			_工程师 =  null; 
			_专业技术 =  null; 
			_服务态度 =  null; 
			_总体评价 =  null; 
			_CreateDate =  null; 
			_CreateBy =  null; 
			_SEQNO = 0;
		}
		#endregion
		
		#region 属性值校验
		
		/// <summary>
		/// 属性值校验
		/// </summary>
		public bool CheckValues()
		{
			bool bResult = true;
			string strError = "";
		
			if ( _ID ==  0)
			{
				bResult = false;
				strError += "\r\n 非空值不能为: "+_ID;
			}
			
			if( !bResult )
					throw new ArgumentOutOfRangeException(strError);
			return bResult;
			
		}
		
		#endregion
		
		
		
	
		#region Required Fields Only Constructor
		
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public tbQuestionnaireEntity(
		int para_ID		)
		: this()
		{
					_ID = para_ID;
			_客户名称 = String.Empty;
			_服务项目 = null;
			_客户电话 = String.Empty;
			_反馈人 = String.Empty;
			_ASK1 = null;
			_ASK2 = null;
			_ASK3 = null;
			_ASK4 = null;
			_ASK5 = null;
			_ASK6 = null;
			_ASK7 = null;
			_ASK8 = null;
			_ASK9 = null;
			_ASK10 = null;
			_工程师 = null;
			_专业技术 = null;
			_服务态度 = null;
			_总体评价 = null;
			_CreateDate = null;
			_CreateBy = null;
		}
		#endregion 

		
		#region 公有属性
			
			/// <summary>
			/// 行号，顺序号。系统默认的属性,对这个属性不要作操作.属性值在架构中已经处理
			/// </summary>
			public virtual int SEQNO
			{
				get { return _SEQNO; }
				set { _SEQNO = value; }
			}
		
			
		/// <summary>
		/// IDID
		/// </summary>		
		public virtual int ID
		{
			get { return _ID; }
			set { _ID = value; }
		}
			
		/// <summary>
		/// 客户名称客户名称
		/// </summary>		
		public virtual string 客户名称
		{
			get { return _客户名称; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for 客户名称", value, value.ToString());
				
				_客户名称 = value;
			}
		}
			
		/// <summary>
		/// 服务项目服务项目
		/// </summary>		
		public virtual int? 服务项目
		{
			get { return _服务项目; }
			set { _服务项目 = value; }
		}
			
		/// <summary>
		/// 客户电话客户电话
		/// </summary>		
		public virtual string 客户电话
		{
			get { return _客户电话; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 20)
						throw new ArgumentOutOfRangeException("Invalid value for 客户电话", value, value.ToString());
				
				_客户电话 = value;
			}
		}
			
		/// <summary>
		/// 反馈人反馈人
		/// </summary>		
		public virtual string 反馈人
		{
			get { return _反馈人; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 20)
						throw new ArgumentOutOfRangeException("Invalid value for 反馈人", value, value.ToString());
				
				_反馈人 = value;
			}
		}
			
		/// <summary>
		/// ASK1ASK1
		/// </summary>		
		public virtual bool? ASK1
		{
			get { return _ASK1; }
			set { _ASK1 = value; }
		}
			
		/// <summary>
		/// ASK2ASK2
		/// </summary>		
		public virtual bool? ASK2
		{
			get { return _ASK2; }
			set { _ASK2 = value; }
		}
			
		/// <summary>
		/// ASK3ASK3
		/// </summary>		
		public virtual bool? ASK3
		{
			get { return _ASK3; }
			set { _ASK3 = value; }
		}
			
		/// <summary>
		/// ASK4ASK4
		/// </summary>		
		public virtual bool? ASK4
		{
			get { return _ASK4; }
			set { _ASK4 = value; }
		}
			
		/// <summary>
		/// ASK5ASK5
		/// </summary>		
		public virtual bool? ASK5
		{
			get { return _ASK5; }
			set { _ASK5 = value; }
		}
			
		/// <summary>
		/// ASK6ASK6
		/// </summary>		
		public virtual bool? ASK6
		{
			get { return _ASK6; }
			set { _ASK6 = value; }
		}
			
		/// <summary>
		/// ASK7ASK7
		/// </summary>		
		public virtual bool? ASK7
		{
			get { return _ASK7; }
			set { _ASK7 = value; }
		}
			
		/// <summary>
		/// ASK8ASK8
		/// </summary>		
		public virtual bool? ASK8
		{
			get { return _ASK8; }
			set { _ASK8 = value; }
		}
			
		/// <summary>
		/// ASK9ASK9
		/// </summary>		
		public virtual bool? ASK9
		{
			get { return _ASK9; }
			set { _ASK9 = value; }
		}
			
		/// <summary>
		/// ASK10ASK10
		/// </summary>		
		public virtual bool? ASK10
		{
			get { return _ASK10; }
			set { _ASK10 = value; }
		}
			
		/// <summary>
		/// 工程师工程师
		/// </summary>		
		public virtual int? 工程师
		{
			get { return _工程师; }
			set { _工程师 = value; }
		}
			
		/// <summary>
		/// 专业技术专业技术
		/// </summary>		
		public virtual int? 专业技术
		{
			get { return _专业技术; }
			set { _专业技术 = value; }
		}
			
		/// <summary>
		/// 服务态度服务态度
		/// </summary>		
		public virtual int? 服务态度
		{
			get { return _服务态度; }
			set { _服务态度 = value; }
		}
			
		/// <summary>
		/// 总体评价总体评价
		/// </summary>		
		public virtual int? 总体评价
		{
			get { return _总体评价; }
			set { _总体评价 = value; }
		}
			
		/// <summary>
		/// CreateDate创建时间
		/// </summary>		
		public virtual DateTime? CreateDate
		{
			get { return _CreateDate; }
			set { _CreateDate = value; }
		}
			
		/// <summary>
		/// CreateBy创建人
		/// </summary>		
		public virtual int? CreateBy
		{
			get { return _CreateBy; }
			set { _CreateBy = value; }
		}
			


		#endregion 	
		
		
        #region DAO操作
		
		
		/// <summary>
        /// 获取所有实体的列表
        /// </summary>
        /// <returns></returns>
        public override List<tbQuestionnaireEntity> GetAll()
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [ID],[客户名称],[服务项目],[客户电话],[反馈人],[ASK1],[ASK2],[ASK3],[ASK4],[ASK5],[ASK6],[ASK7],[ASK8],[ASK9],[ASK10],[工程师],[专业技术],[服务态度],[总体评价],[CreateDate],[CreateBy] from [tb_Questionnaire] ");
	
            List<tbQuestionnaireEntity> list = new List<tbQuestionnaireEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
				int seq = 0;
                while (dataReader.Read())
                {	seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		/// <summary>
        /// 获取所有实体的列表总行数
        /// </summary>
        /// <returns></returns>
        public override int GetTotalRecords()
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("  select count([ID])  from [tb_Questionnaire] ");
	
            Database db = GetDatabase();
            return (int)db.ExecuteScalar(CommandType.Text, strSql.ToString());
        }
		
		/// <summary>
        /// 获取所有实体的列表总行数
        /// </summary>
        /// <returns></returns>
        public override int GetTotalRecords(string sqlCondition)
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("  select count([ID])  from [tb_Questionnaire]  ");
	
			 if (sqlCondition.Trim() != "")
            {
                strSql.Append(" where " + sqlCondition);
            }
            Database db = GetDatabase();
            return (int)db.ExecuteScalar(CommandType.Text, strSql.ToString());
        }	
		
		
		/// <summary>
        /// 按条件查询,得到一页的对应的结果列表
        /// </summary>
        /// <param name="strWhere">条件</param>
		/// <param name="PageSize">每页大小</param>
		/// <param name="CurrentPageIndex">当前页码</param>
        /// <returns></returns>
		 public override List<tbQuestionnaireEntity> GetAllByQuery(string strWhere, int PageSize, int CurrentPageIndex)
        {
            StringBuilder strSql = new StringBuilder();
            if (strWhere.Contains("order".ToLower()))
            {
                throw new Exception("分页查询的sql条件中不能包括排序子句，请调用重载方法实现有条件的排序筛选");
            }
		 
			strSql.Append("select top ").Append(PageSize).Append("  [ID],[客户名称],[服务项目],[客户电话],[反馈人],[ASK1],[ASK2],[ASK3],[ASK4],[ASK5],[ASK6],[ASK7],[ASK8],[ASK9],[ASK10],[工程师],[专业技术],[服务态度],[总体评价],[CreateDate],[CreateBy] from [tb_Questionnaire] where ");

			 if (strWhere.Trim() != "")
            {
                strSql.Append("  " + strWhere + " and ");
            }
			  strSql.Append(" ID not in ( ");
			 strSql.Append(" select top ").Append(PageSize*(CurrentPageIndex-1)).Append("  [ID] from [tb_Questionnaire] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere );
            }
			strSql.Append(" ) " );

            List<tbQuestionnaireEntity> list = new List<tbQuestionnaireEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
			   int seq = PageSize * (CurrentPageIndex - 1);
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }
		
		
			/// <summary>
        /// 按条件查询,得到一页的对应的结果列表
        /// </summary>
        /// <param name="strWhere">条件</param>
		/// <param name="PageSize">每页大小</param>
		/// <param name="CurrentPageIndex">当前页码</param>
		/// <param name="strSort">ex:order by id desc</param>
        /// <returns></returns>
		 public override List<tbQuestionnaireEntity> GetAllByQuery(string strWhere,string strSort, int PageSize, int CurrentPageIndex)
        {
            StringBuilder strSql = new StringBuilder();
            if (strWhere.Contains("order".ToLower()))
            {
                throw new Exception("分页查询的sql条件中不能包括排序子句，请调用重载方法实现有条件的排序筛选");
            }
		 
			strSql.Append("select top ").Append(PageSize).Append("  [ID],[客户名称],[服务项目],[客户电话],[反馈人],[ASK1],[ASK2],[ASK3],[ASK4],[ASK5],[ASK6],[ASK7],[ASK8],[ASK9],[ASK10],[工程师],[专业技术],[服务态度],[总体评价],[CreateDate],[CreateBy] from [tb_Questionnaire] where ");

			 if (strWhere.Trim() != "")
            {
                strSql.Append("  " + strWhere + " and ");
            }
			  strSql.Append(" ID not in ( ");
			 strSql.Append(" select top ").Append(PageSize*(CurrentPageIndex-1)).Append("  [ID] from [tb_Questionnaire] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere+" " ).Append(strSort);
            }
			strSql.Append(" ) " ).Append(strSort);

            List<tbQuestionnaireEntity> list = new List<tbQuestionnaireEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
				int seq = PageSize * (CurrentPageIndex - 1);
                while (dataReader.Read())
                {	
					seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }
		
		
		/// <summary>
        /// 按条件查询,得到对应的结果列表
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public override List<tbQuestionnaireEntity> GetAllByQuery(string strWhere)
        {
			strWhere = SQLInjectionFilter(strWhere);
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [ID],[客户名称],[服务项目],[客户电话],[反馈人],[ASK1],[ASK2],[ASK3],[ASK4],[ASK5],[ASK6],[ASK7],[ASK8],[ASK9],[ASK10],[工程师],[专业技术],[服务态度],[总体评价],[CreateDate],[CreateBy] from tb_Questionnaire ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<tbQuestionnaireEntity> list = new List<tbQuestionnaireEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            { 
				int seq = 0;
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		
		/// <summary>
        /// 按条件查询,得到对应的结果列表
        /// </summary>
        /// <param name="strWhere"></param>
		/// <param name="parameters">sql条件中的参数</param>
        /// <returns></returns>
        public override List<tbQuestionnaireEntity> GetAllByQuery(string strWhere, List<IDataParameter> parameters)
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [ID],[客户名称],[服务项目],[客户电话],[反馈人],[ASK1],[ASK2],[ASK3],[ASK4],[ASK5],[ASK6],[ASK7],[ASK8],[ASK9],[ASK10],[工程师],[专业技术],[服务态度],[总体评价],[CreateDate],[CreateBy] from [tb_Questionnaire] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<tbQuestionnaireEntity> list = new List<tbQuestionnaireEntity>();
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            foreach (IDataParameter sp in parameters)
            {
                db.AddInParameter(dbCommand, sp.ParameterName, sp.DbType, sp.Value);
            }

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
				int seq =0 ;
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		

		
		
		/// <summary>
        /// 获取按条件查询以后的结果列表的前指定rowNumber行记录
        /// </summary>
        /// <param name="strWhere">不带where关键字的SQL条件语句</param>
        /// <param name="rowNumber"></param>
        /// <returns></returns>
        public override List<tbQuestionnaireEntity> GetAllByQuery(string strWhere, List<IDataParameter> parameters, int rowNumber)
        {

            StringBuilder strSql = new StringBuilder();
			strSql.Append("select top ").Append(rowNumber).Append("  [ID],[客户名称],[服务项目],[客户电话],[反馈人],[ASK1],[ASK2],[ASK3],[ASK4],[ASK5],[ASK6],[ASK7],[ASK8],[ASK9],[ASK10],[工程师],[专业技术],[服务态度],[总体评价],[CreateDate],[CreateBy] from [tb_Questionnaire] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<tbQuestionnaireEntity> list = new List<tbQuestionnaireEntity>();
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            foreach (IDataParameter sp in parameters)
            {
                db.AddInParameter(dbCommand, sp.ParameterName, sp.DbType, sp.Value);
            }

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {	
				int seq = 0;
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		/// <summary>
        /// 获取按条件查询以后的结果列表的前指定rowNumber行记录
        /// </summary>
        /// <param name="strWhere">不带where关键字的SQL条件语句: AND AA=@AA</param>
        /// <param name="rowNumber"></param>
        /// <returns></returns>
        public override List<tbQuestionnaireEntity> GetAllByQuery(string strWhere, int rowNumber)
        {
		    strWhere = SQLInjectionFilter(strWhere);
            StringBuilder strSql = new StringBuilder();
			
			strSql.Append("select top ").Append(rowNumber).Append("  [ID],[客户名称],[服务项目],[客户电话],[反馈人],[ASK1],[ASK2],[ASK3],[ASK4],[ASK5],[ASK6],[ASK7],[ASK8],[ASK9],[ASK10],[工程师],[专业技术],[服务态度],[总体评价],[CreateDate],[CreateBy] from [tb_Questionnaire] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where  " + strWhere);
            }
            List<tbQuestionnaireEntity> list = new List<tbQuestionnaireEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
				int seq=0;
                while (dataReader.Read())
                {	
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		
		
		
		
		
        /// <summary>
        /// 按主键查询对应的实体
        /// </summary>
        /// <param name="id">主键ID</param>
        /// <returns></returns>
        public override tbQuestionnaireEntity GetById(int id)
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [ID],[客户名称],[服务项目],[客户电话],[反馈人],[ASK1],[ASK2],[ASK3],[ASK4],[ASK5],[ASK6],[ASK7],[ASK8],[ASK9],[ASK10],[工程师],[专业技术],[服务态度],[总体评价],[CreateDate],[CreateBy] from [tb_Questionnaire]  where ID= @ID ");
				
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, id);
            tbQuestionnaireEntity entity = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    entity = ReaderBind(dataReader);
                }
            }
            return entity;

        }
		
		
		 /// <summary>
        /// 保存实体
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override int Save()
        {
			
            if (this.ID ==0)
            {
                this.ID = GetMax("tb_Questionnaire");
            }
            StringBuilder strSql = new StringBuilder();
			strSql.Append("insert into  tb_Questionnaire (");
			strSql.Append("[ID],[客户名称],[服务项目],[客户电话],[反馈人],[ASK1],[ASK2],[ASK3],[ASK4],[ASK5],[ASK6],[ASK7],[ASK8],[ASK9],[ASK10],[工程师],[专业技术],[服务态度],[总体评价],[CreateDate],[CreateBy] )");
			strSql.Append(" values (");
			strSql.Append("@ID,@客户名称,@服务项目,@客户电话,@反馈人,@ASK1,@ASK2,@ASK3,@ASK4,@ASK5,@ASK6,@ASK7,@ASK8,@ASK9,@ASK10,@工程师,@专业技术,@服务态度,@总体评价,@CreateDate,@CreateBy)");

            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "ID", DbType.Int32, this.ID);
			db.AddInParameter(dbCommand, "客户名称", DbType.String, this.客户名称);
			if (this.服务项目 == null)
			{
			db.AddInParameter(dbCommand, "服务项目", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "服务项目", DbType.Int32, this.服务项目.Value);
			}
			db.AddInParameter(dbCommand, "客户电话", DbType.String, this.客户电话);
			db.AddInParameter(dbCommand, "反馈人", DbType.String, this.反馈人);
			if (this.ASK1 == null)
			{
			db.AddInParameter(dbCommand, "ASK1", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK1", DbType.Decimal, this.ASK1.Value);
			}
			if (this.ASK2 == null)
			{
			db.AddInParameter(dbCommand, "ASK2", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK2", DbType.Decimal, this.ASK2.Value);
			}
			if (this.ASK3 == null)
			{
			db.AddInParameter(dbCommand, "ASK3", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK3", DbType.Decimal, this.ASK3.Value);
			}
			if (this.ASK4 == null)
			{
			db.AddInParameter(dbCommand, "ASK4", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK4", DbType.Decimal, this.ASK4.Value);
			}
			if (this.ASK5 == null)
			{
			db.AddInParameter(dbCommand, "ASK5", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK5", DbType.Decimal, this.ASK5.Value);
			}
			if (this.ASK6 == null)
			{
			db.AddInParameter(dbCommand, "ASK6", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK6", DbType.Decimal, this.ASK6.Value);
			}
			if (this.ASK7 == null)
			{
			db.AddInParameter(dbCommand, "ASK7", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK7", DbType.Decimal, this.ASK7.Value);
			}
			if (this.ASK8 == null)
			{
			db.AddInParameter(dbCommand, "ASK8", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK8", DbType.Decimal, this.ASK8.Value);
			}
			if (this.ASK9 == null)
			{
			db.AddInParameter(dbCommand, "ASK9", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK9", DbType.Decimal, this.ASK9.Value);
			}
			if (this.ASK10 == null)
			{
			db.AddInParameter(dbCommand, "ASK10", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK10", DbType.Decimal, this.ASK10.Value);
			}
			if (this.工程师 == null)
			{
			db.AddInParameter(dbCommand, "工程师", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "工程师", DbType.Int32, this.工程师.Value);
			}
			if (this.专业技术 == null)
			{
			db.AddInParameter(dbCommand, "专业技术", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "专业技术", DbType.Int32, this.专业技术.Value);
			}
			if (this.服务态度 == null)
			{
			db.AddInParameter(dbCommand, "服务态度", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "服务态度", DbType.Int32, this.服务态度.Value);
			}
			if (this.总体评价 == null)
			{
			db.AddInParameter(dbCommand, "总体评价", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "总体评价", DbType.Int32, this.总体评价.Value);
			}
			if (this.CreateDate == null)
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, this.CreateDate.Value);
			}
			if (this.CreateBy == null)
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, this.CreateBy.Value);
			}

			return db.ExecuteNonQuery(dbCommand);
		  
      
        }
		

		
        /// <summary>
        /// 保存实体
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override int Save(tbQuestionnaireEntity entity)
        {
			
            if (entity.ID == 0)
            {
                entity.ID = GetMax("tb_Questionnaire");
            }
            StringBuilder strSql = new StringBuilder();
			strSql.Append("insert into  tb_Questionnaire (");
			strSql.Append("[ID],[客户名称],[服务项目],[客户电话],[反馈人],[ASK1],[ASK2],[ASK3],[ASK4],[ASK5],[ASK6],[ASK7],[ASK8],[ASK9],[ASK10],[工程师],[专业技术],[服务态度],[总体评价],[CreateDate],[CreateBy] )");
			strSql.Append(" values (");
			strSql.Append("@ID,@客户名称,@服务项目,@客户电话,@反馈人,@ASK1,@ASK2,@ASK3,@ASK4,@ASK5,@ASK6,@ASK7,@ASK8,@ASK9,@ASK10,@工程师,@专业技术,@服务态度,@总体评价,@CreateDate,@CreateBy)");

            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "ID", DbType.Int32, entity.ID);
			db.AddInParameter(dbCommand, "客户名称", DbType.String, entity.客户名称);
			if (entity.服务项目 == null)
			{
			db.AddInParameter(dbCommand, "服务项目", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "服务项目", DbType.Int32, entity.服务项目.Value);
			}
			db.AddInParameter(dbCommand, "客户电话", DbType.String, entity.客户电话);
			db.AddInParameter(dbCommand, "反馈人", DbType.String, entity.反馈人);
			if (entity.ASK1 == null)
			{
			db.AddInParameter(dbCommand, "ASK1", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK1", DbType.Decimal, entity.ASK1.Value);
			}
			if (entity.ASK2 == null)
			{
			db.AddInParameter(dbCommand, "ASK2", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK2", DbType.Decimal, entity.ASK2.Value);
			}
			if (entity.ASK3 == null)
			{
			db.AddInParameter(dbCommand, "ASK3", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK3", DbType.Decimal, entity.ASK3.Value);
			}
			if (entity.ASK4 == null)
			{
			db.AddInParameter(dbCommand, "ASK4", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK4", DbType.Decimal, entity.ASK4.Value);
			}
			if (entity.ASK5 == null)
			{
			db.AddInParameter(dbCommand, "ASK5", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK5", DbType.Decimal, entity.ASK5.Value);
			}
			if (entity.ASK6 == null)
			{
			db.AddInParameter(dbCommand, "ASK6", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK6", DbType.Decimal, entity.ASK6.Value);
			}
			if (entity.ASK7 == null)
			{
			db.AddInParameter(dbCommand, "ASK7", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK7", DbType.Decimal, entity.ASK7.Value);
			}
			if (entity.ASK8 == null)
			{
			db.AddInParameter(dbCommand, "ASK8", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK8", DbType.Decimal, entity.ASK8.Value);
			}
			if (entity.ASK9 == null)
			{
			db.AddInParameter(dbCommand, "ASK9", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK9", DbType.Decimal, entity.ASK9.Value);
			}
			if (entity.ASK10 == null)
			{
			db.AddInParameter(dbCommand, "ASK10", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK10", DbType.Decimal, entity.ASK10.Value);
			}
			if (entity.工程师 == null)
			{
			db.AddInParameter(dbCommand, "工程师", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "工程师", DbType.Int32, entity.工程师.Value);
			}
			if (entity.专业技术 == null)
			{
			db.AddInParameter(dbCommand, "专业技术", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "专业技术", DbType.Int32, entity.专业技术.Value);
			}
			if (entity.服务态度 == null)
			{
			db.AddInParameter(dbCommand, "服务态度", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "服务态度", DbType.Int32, entity.服务态度.Value);
			}
			if (entity.总体评价 == null)
			{
			db.AddInParameter(dbCommand, "总体评价", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "总体评价", DbType.Int32, entity.总体评价.Value);
			}
			if (entity.CreateDate == null)
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, entity.CreateDate.Value);
			}
			if (entity.CreateBy == null)
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, entity.CreateBy.Value);
			}

			return db.ExecuteNonQuery(dbCommand);
		  
      
        }
		
		
        /// <summary>
        /// 保存或者更新(如果传入的实体主键为空则保存,否则做更新操作)
        /// </summary>
        /// <param name="entity">传入的实体</param>
        /// <returns>影响的行数</returns>
        public override int SaveOrUpdate(tbQuestionnaireEntity entity)
        {
			
            if (entity.ID  == 0)
            {
                if (Save(entity)>0)
                {
                    return 1;
                }
                else
                {
                    return 0;
                }
            }
            else
            {
                return Update(entity);
            }
        }
		
		/// <summary>
        /// 保存或者更新(如果传入的实体主键为空则保存,否则做更新操作)
        /// </summary>
        /// <param name="entity">传入的实体</param>
        /// <returns>影响的行数</returns>
        public override int SaveOrUpdate()
        {
		
            if (this.ID  == 0)
            {
                if (Save()>0)
                {
                    return 1;
                }
                else
                {
                    return 0;
                }
            }
            else
            {
                return Update();
            }
        }
		
		/// <summary>
        /// 是否存在对应主键ID的记录
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public override bool IsExist(int ID)
        {
            Database db = GetDatabase();
            StringBuilder strSql = new StringBuilder();
            			 strSql.Append("select count(1) from tb_Questionnaire where ID=@ID ");

            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, ID);//这里为ID是因为原有代码把主键都变成了ID.
            int cmdresult;
            object obj = db.ExecuteScalar(dbCommand);
            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
            {
                cmdresult = 0;
            }
            else
            {
                cmdresult = int.Parse(obj.ToString());
            }
            if (cmdresult == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
		
		
		/// <summary>
        /// 删除对应的实体
        /// </summary>
        /// <param name="entity"></param>
        public override int Delete(tbQuestionnaireEntity entity)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete tb_Questionnaire ");
            strSql.Append(" where ID=@ID ");
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, entity.ID );
            return db.ExecuteNonQuery(dbCommand);
        }
		
		/// <summary>
        /// 删除主键ID对应的记录
        /// </summary>
        /// <param name="id"></param>
        public override int Delete(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete tb_Questionnaire ");
            strSql.Append(" where ID=@ID ");
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, id);
            return db.ExecuteNonQuery(dbCommand);
        }
		
		
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public override int Update()
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update tb_Questionnaire set ");
			strSql.Append("[ID]=@ID,[客户名称]=@客户名称,[服务项目]=@服务项目,[客户电话]=@客户电话,[反馈人]=@反馈人,[ASK1]=@ASK1,[ASK2]=@ASK2,[ASK3]=@ASK3,[ASK4]=@ASK4,[ASK5]=@ASK5,[ASK6]=@ASK6,[ASK7]=@ASK7,[ASK8]=@ASK8,[ASK9]=@ASK9,[ASK10]=@ASK10,[工程师]=@工程师,[专业技术]=@专业技术,[服务态度]=@服务态度,[总体评价]=@总体评价,[CreateDate]=@CreateDate,[CreateBy]=@CreateBy ");

            strSql.Append(" where ID=@ID ");
            Database db = GetDatabase();
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "ID", DbType.Int32, this.ID );
			db.AddInParameter(dbCommand, "客户名称", DbType.String, this.客户名称);
			if (this.服务项目 == null)
			{
			db.AddInParameter(dbCommand, "服务项目", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "服务项目", DbType.Int32, this.服务项目.Value);
			}
			db.AddInParameter(dbCommand, "客户电话", DbType.String, this.客户电话);
			db.AddInParameter(dbCommand, "反馈人", DbType.String, this.反馈人);
			if (this.ASK1 == null)
			{
			db.AddInParameter(dbCommand, "ASK1", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK1", DbType.Decimal, this.ASK1.Value);
			}
			if (this.ASK2 == null)
			{
			db.AddInParameter(dbCommand, "ASK2", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK2", DbType.Decimal, this.ASK2.Value);
			}
			if (this.ASK3 == null)
			{
			db.AddInParameter(dbCommand, "ASK3", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK3", DbType.Decimal, this.ASK3.Value);
			}
			if (this.ASK4 == null)
			{
			db.AddInParameter(dbCommand, "ASK4", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK4", DbType.Decimal, this.ASK4.Value);
			}
			if (this.ASK5 == null)
			{
			db.AddInParameter(dbCommand, "ASK5", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK5", DbType.Decimal, this.ASK5.Value);
			}
			if (this.ASK6 == null)
			{
			db.AddInParameter(dbCommand, "ASK6", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK6", DbType.Decimal, this.ASK6.Value);
			}
			if (this.ASK7 == null)
			{
			db.AddInParameter(dbCommand, "ASK7", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK7", DbType.Decimal, this.ASK7.Value);
			}
			if (this.ASK8 == null)
			{
			db.AddInParameter(dbCommand, "ASK8", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK8", DbType.Decimal, this.ASK8.Value);
			}
			if (this.ASK9 == null)
			{
			db.AddInParameter(dbCommand, "ASK9", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK9", DbType.Decimal, this.ASK9.Value);
			}
			if (this.ASK10 == null)
			{
			db.AddInParameter(dbCommand, "ASK10", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK10", DbType.Decimal, this.ASK10.Value);
			}
			if (this.工程师 == null)
			{
			db.AddInParameter(dbCommand, "工程师", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "工程师", DbType.Int32, this.工程师.Value);
			}
			if (this.专业技术 == null)
			{
			db.AddInParameter(dbCommand, "专业技术", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "专业技术", DbType.Int32, this.专业技术.Value);
			}
			if (this.服务态度 == null)
			{
			db.AddInParameter(dbCommand, "服务态度", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "服务态度", DbType.Int32, this.服务态度.Value);
			}
			if (this.总体评价 == null)
			{
			db.AddInParameter(dbCommand, "总体评价", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "总体评价", DbType.Int32, this.总体评价.Value);
			}
			if (this.CreateDate == null)
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, this.CreateDate.Value);
			}
			if (this.CreateBy == null)
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, this.CreateBy.Value);
			}

			
			return	db.ExecuteNonQuery(dbCommand);

		}
		



		
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public override int Update(tbQuestionnaireEntity entity)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update tb_Questionnaire set ");
			strSql.Append("[ID]=@ID,[客户名称]=@客户名称,[服务项目]=@服务项目,[客户电话]=@客户电话,[反馈人]=@反馈人,[ASK1]=@ASK1,[ASK2]=@ASK2,[ASK3]=@ASK3,[ASK4]=@ASK4,[ASK5]=@ASK5,[ASK6]=@ASK6,[ASK7]=@ASK7,[ASK8]=@ASK8,[ASK9]=@ASK9,[ASK10]=@ASK10,[工程师]=@工程师,[专业技术]=@专业技术,[服务态度]=@服务态度,[总体评价]=@总体评价,[CreateDate]=@CreateDate,[CreateBy]=@CreateBy ");

            strSql.Append(" where ID=@ID ");
            Database db = GetDatabase();
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "ID", DbType.Int32, entity.ID );
			db.AddInParameter(dbCommand, "客户名称", DbType.String, entity.客户名称);
			if (entity.服务项目 == null)
			{
			db.AddInParameter(dbCommand, "服务项目", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "服务项目", DbType.Int32, entity.服务项目.Value);
			}
			db.AddInParameter(dbCommand, "客户电话", DbType.String, entity.客户电话);
			db.AddInParameter(dbCommand, "反馈人", DbType.String, entity.反馈人);
			if (entity.ASK1 == null)
			{
			db.AddInParameter(dbCommand, "ASK1", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK1", DbType.Decimal, entity.ASK1.Value);
			}
			if (entity.ASK2 == null)
			{
			db.AddInParameter(dbCommand, "ASK2", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK2", DbType.Decimal, entity.ASK2.Value);
			}
			if (entity.ASK3 == null)
			{
			db.AddInParameter(dbCommand, "ASK3", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK3", DbType.Decimal, entity.ASK3.Value);
			}
			if (entity.ASK4 == null)
			{
			db.AddInParameter(dbCommand, "ASK4", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK4", DbType.Decimal, entity.ASK4.Value);
			}
			if (entity.ASK5 == null)
			{
			db.AddInParameter(dbCommand, "ASK5", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK5", DbType.Decimal, entity.ASK5.Value);
			}
			if (entity.ASK6 == null)
			{
			db.AddInParameter(dbCommand, "ASK6", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK6", DbType.Decimal, entity.ASK6.Value);
			}
			if (entity.ASK7 == null)
			{
			db.AddInParameter(dbCommand, "ASK7", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK7", DbType.Decimal, entity.ASK7.Value);
			}
			if (entity.ASK8 == null)
			{
			db.AddInParameter(dbCommand, "ASK8", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK8", DbType.Decimal, entity.ASK8.Value);
			}
			if (entity.ASK9 == null)
			{
			db.AddInParameter(dbCommand, "ASK9", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK9", DbType.Decimal, entity.ASK9.Value);
			}
			if (entity.ASK10 == null)
			{
			db.AddInParameter(dbCommand, "ASK10", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ASK10", DbType.Decimal, entity.ASK10.Value);
			}
			if (entity.工程师 == null)
			{
			db.AddInParameter(dbCommand, "工程师", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "工程师", DbType.Int32, entity.工程师.Value);
			}
			if (entity.专业技术 == null)
			{
			db.AddInParameter(dbCommand, "专业技术", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "专业技术", DbType.Int32, entity.专业技术.Value);
			}
			if (entity.服务态度 == null)
			{
			db.AddInParameter(dbCommand, "服务态度", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "服务态度", DbType.Int32, entity.服务态度.Value);
			}
			if (entity.总体评价 == null)
			{
			db.AddInParameter(dbCommand, "总体评价", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "总体评价", DbType.Int32, entity.总体评价.Value);
			}
			if (entity.CreateDate == null)
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, entity.CreateDate.Value);
			}
			if (entity.CreateBy == null)
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, entity.CreateBy.Value);
			}

			
			return	db.ExecuteNonQuery(dbCommand);

		}
		


		
		
		
		
		/// <summary>
        /// 对象实体绑定数据
		///生成构造为list的构造器
        /// </summary>
        private tbQuestionnaireEntity ReaderBind(IDataReader dataReader,int seq)
        {
            ITOMMS.Entity.tbQuestionnaireEntity entity = new ITOMMS.Entity.tbQuestionnaireEntity();
			entity.SEQNO = seq;
            object obj;
			obj = dataReader["ID"];
			 if (obj != null && obj != DBNull.Value)
			 {
			 entity.ID = (int)obj;
			 }
			 entity.客户名称= dataReader["客户名称"].ToString();
			 obj=dataReader["服务项目"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.服务项目= (int)obj;
			}
			 entity.客户电话= dataReader["客户电话"].ToString();
			 entity.反馈人= dataReader["反馈人"].ToString();
			 obj=dataReader["ASK1"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK1= (bool)obj;
			}
			 obj=dataReader["ASK2"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK2= (bool)obj;
			}
			 obj=dataReader["ASK3"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK3= (bool)obj;
			}
			 obj=dataReader["ASK4"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK4= (bool)obj;
			}
			 obj=dataReader["ASK5"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK5= (bool)obj;
			}
			 obj=dataReader["ASK6"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK6= (bool)obj;
			}
			 obj=dataReader["ASK7"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK7= (bool)obj;
			}
			 obj=dataReader["ASK8"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK8= (bool)obj;
			}
			 obj=dataReader["ASK9"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK9= (bool)obj;
			}
			 obj=dataReader["ASK10"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK10= (bool)obj;
			}
			 obj=dataReader["工程师"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.工程师= (int)obj;
			}
			 obj=dataReader["专业技术"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.专业技术= (int)obj;
			}
			 obj=dataReader["服务态度"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.服务态度= (int)obj;
			}
			 obj=dataReader["总体评价"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.总体评价= (int)obj;
			}
			 obj=dataReader["CreateDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateDate= (DateTime)obj;
			}
			 obj=dataReader["CreateBy"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateBy= (int)obj;
			}

            return entity;
        }
		
		
				/// <summary>
        /// 对象实体绑定数据
		///生成构造为list的构造器
        /// </summary>
        private tbQuestionnaireEntity ReaderBind(IDataReader dataReader)
        {
            ITOMMS.Entity.tbQuestionnaireEntity entity = new ITOMMS.Entity.tbQuestionnaireEntity();
			object obj;
			obj = dataReader["ID"];
			 if (obj != null && obj != DBNull.Value)
			 {
			 entity.ID = (int)obj;
			 }
			 entity.客户名称= dataReader["客户名称"].ToString();
			 obj=dataReader["服务项目"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.服务项目= (int)obj;
			}
			 entity.客户电话= dataReader["客户电话"].ToString();
			 entity.反馈人= dataReader["反馈人"].ToString();
			 obj=dataReader["ASK1"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK1= (bool)obj;
			}
			 obj=dataReader["ASK2"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK2= (bool)obj;
			}
			 obj=dataReader["ASK3"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK3= (bool)obj;
			}
			 obj=dataReader["ASK4"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK4= (bool)obj;
			}
			 obj=dataReader["ASK5"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK5= (bool)obj;
			}
			 obj=dataReader["ASK6"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK6= (bool)obj;
			}
			 obj=dataReader["ASK7"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK7= (bool)obj;
			}
			 obj=dataReader["ASK8"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK8= (bool)obj;
			}
			 obj=dataReader["ASK9"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK9= (bool)obj;
			}
			 obj=dataReader["ASK10"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ASK10= (bool)obj;
			}
			 obj=dataReader["工程师"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.工程师= (int)obj;
			}
			 obj=dataReader["专业技术"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.专业技术= (int)obj;
			}
			 obj=dataReader["服务态度"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.服务态度= (int)obj;
			}
			 obj=dataReader["总体评价"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.总体评价= (int)obj;
			}
			 obj=dataReader["CreateDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateDate= (DateTime)obj;
			}
			 obj=dataReader["CreateBy"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateBy= (int)obj;
			}

            return entity;
        }
		
		
		
		 #endregion
		
	}
}
